<!DOCTYPE html>
<html>
	<head>
		<!--
        	作者：刘开新
        	时间：2018-09-29
        	描述：
        -->
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<table id="mytable" border="">
			<thead>
				<tr>
					<th>第一</th><th>第二</th><th>第三</th>
				</tr>
			</thead>
			<tbody>
				<tr>
					<td>奇数行</td><td>2</td><td>3</td>
				</tr>
				<tr>
					<td>偶数行</td><td>2</td><td>3</td>
				</tr>
				<tr>
					<td>奇数行</td><td>2</td><td>3</td>
				</tr>
				<tr>
					<td>偶数行</td><td>2</td><td>3</td>
				</tr>
				<tr>
					<td>奇数行</td><td>2</td><td>3</td>
				</tr>
				<tr>
					<td>偶数行</td><td>2</td><td>3</td>
				</tr>
			</tbody>
		</table>
		<script type="text/javascript">
			var tr=document.getElementById("mytable").getElementsByTagName("tbody").item(0).getElementsByTagName("tr");
			var tab=tr.length;
			for (var i=0;i<tab;i++) {
				if(i%2==0){
					tr.item(i).style.color="red";
				}
			}
			
			
		</script>
		
	</body>
</html>
